README file of icp code, April 2011, Micha Hersch

This is the code for the icp implementation described in the following paper:
Hersch, Billard, Bergmann (2012),"Iterative Estimation of Rigid-Body Transformation -
Application to Robust Object Tracking and Iterative Closest Point",
Journal of Mathematical Imaging and Vision, 43(1):1-9 

You can compile using cmake, in which case you need to have cmake installed. 
This is done like this from the current directory: 

cmake .

Alternatively, you can also write your own makefile. No fancy library to link to. 


Example use:
./icp data/t1.txt data/t2.txt 1000000 --verbose


You will get the transformation mapping points in sample1.txt to points in sample2.txt.
Those ascii file are just a list of 3d coordinates (3 columns corresponding to x y and z
respectively). It is assumed that (almost) all points in t1.txt have a corresponding
point in t2.txt (although the reverse is not necessary). In this case you give it
maximum 1000000 iterations for the estimation. --verbose prints the result of every 100
iterations so you can see if the algorithm has reach a maximum or not and adapt the
number of iterations accordingly. 

If you don't want this, just use:

./icp data/t1.txt data/t2.txt 1000000


The resulting transformations are given in the following format:
<angle>: <b1> <b2> <b3> <t1> <t2> <t3>

where <angle> is the rotation angle in rad and <b> is the rodrigues parameter of the
rotation sin(angle/2)*rotation_axis and <t> is the translation vector.

If you want to output the homogeneous matrix instead you just need to uncomment
a couple of lines in the code.    


If you want to regenerate a data set data/t1.txt and data/t2.txt do the following
(in linux and mac, other OS have corresponding commands):

1. rm -f CMakeCache.txt
2. cmake . -DGENERATE_DATA=1
3. make generate_data
4. ./generate_data data/t1.txt data/t2.txt 2000

The last command will generate a data set with 2000 data points in t1.txt, transform it
with a random rigid body transformation and print the transformed dataset in data/t2.txt.
It will also print the rigid-body transformation in the console. 

If you then do

./icp data/t1.txt data/t2.txt 1000000

This should recover the rigid-body transformation so approximately the same transformation
will be printed in the console. If it is quite different try increasing the number of
iterations.


